<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="com.biz.utils.ConfigUtil" %>
	<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
    String resoursUrl = ConfigUtil.get("RESOURCES_URL");
%>

<!doctype html>
<html class="no-js"  style=" background: -webkit-gradient(linear, 0% 0%, 0% 100%,from(#FFFFFF), to(#FFFFFF)); padding-bottom:50px;">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>个人中心</title>
<meta name="description" content="">
<meta name="keywords" content="">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<meta name="renderer" content="webkit">
<meta http-equiv="Cache-Control" content="no-siteapp" />
<meta name="format-detection" content="telephone=no" />
	<link rel="stylesheet" href="<%=resoursUrl%>resources/assets/css/dxy.css" />
	<link rel="stylesheet" href="<%=resoursUrl%>resources/assets/css/NnOrange.css" />
  <jsp:include page="/jsp/inc_head.jsp"></jsp:include>
<style>

	.grzxbody_1{
		padding-bottom:60px;
		background-color:#eeeeee;
	}

	.grzx_toux{
		width: 75px;
		height: 75px;
		border-radius: 6px;
		border:1px solid #fff;
	}
	.grzx_name{
		color:#fff;
		font-size:16px;
		margin-top:5px;
	}
	.hyzl_tex{
		height:40px;
		line-height:40px;
		background-color:#ff5d0e;
		color:#fff;
		font-size:16px;
	}
	.jf_list_two{
		height:40px;
		line-height:40px;
		background-color:#fff;
		font-size:14px;
		color:#282828;
		border: 1px solid #b8bece;
		border-top: 0;
	}
	.telnumber{
		color:
				#322b75;
	}
	.add_tip{
		color:#adadad;
		font-size:13px;
	}
	.grxz_hyzl{
		margin-top:18px;
	}
	.grzx_midxx{
		border-bottom:1px solid #b8bece;
		background-color:#fff;
		padding:0;
	}
	.midxx_li{
		border-right:1px solid #b8bece;
		padding:10px 0;
		font-size:13px;
		color:#282828;
	}
	.xx_col{
		color:#d73009;
		font-size:23px;
	}
	.corOrg{
		color:#ff5d0e;
	}

    /*0104修改新增css*/
    .title_right_small{
        color:#fff;
        font-size:12px;
    }
    .ctermyorder {
        background-color: #fff;
        font-size: 14px;
        color: #282828;
        border: 1px solid #b8bece;
        border-top: 0;
    }
    .myjl_b_q{
        padding:8px 10px;
        background-color:#fafafa;
        color:#272727;
        font-size:12px;
    }
    .rgtspan{
        color:#9f9f9f;
        font-size:12px;
        display:inline-block;
        margin-left:15px;
    }
    .grzx_midxx_gai {
        border: 1px solid #b8bece;
        background-color: #fff;
        padding: 0;
        border-top:0;
    }
    .midxx_li_gai{
        padding: 10px 0;
        font-size: 12px;
        color: #cfcfcf;
    }
    /*0104修改新增css*/
</style>
</head>

<body class="grzxbody_1">
<div class="am-g" style="padding:20px 10px 10px;">
	<div class="am-u-sm-12 grxz_top">
		<div class="am-u-sm-12 am-text-center am-pad-none">
			<img src="" id="headWX" class="grzx_toux"/>
			<div class="grzx_name" id="name"></div>
		</div>
	</div>


	<div class="am-u-sm-12 am-pad-none grxz_hyzl">
		<div class="am-u-sm-12 hyzl_tex">
			会员中心
		</div>
		<div class="am-u-sm-12 jf_list_two"  onclick="toMyAccount()">
			<div class="am-u-sm-4 am-pad-none">
				<img src="<%=resoursUrl%>resources/assets/image/icon_rztel_1.png" width="12"/>&nbsp;&nbsp;认证手机
			</div>
			<div class="am-u-sm-7 am-pad-none">
				<div class="telnumber" id="userPhone"></div>
			</div>
			<div class="am-u-sm-1 am-pad-none am-text-right">
				<a>
					<img src="<%=resoursUrl%>resources/assets/image/icon_plus_1.png" height="16"/>
				</a>
			</div>
		</div>
		<div class="am-u-sm-12 jf_list_two" onclick="toBirthDay()">
			<div class="am-u-sm-4 am-pad-none" >
				<img src="<%=resoursUrl%>resources/assets/image/icon_hysr_1.png" width="12"/>&nbsp;&nbsp;会员生日
			</div>
			<div class="am-u-sm-7 am-pad-none" id="userBir">
				<div class="add_tip">点击添加生日</div>
			</div>
			<div class="am-u-sm-1 am-pad-none am-text-right">
				<a>
					<img src="<%=resoursUrl%>resources/assets/image/icon_plus_1.png" height="16"/>
				</a>
			</div>
		</div>
		<div class="am-u-sm-12 jf_list_two" onclick="toAddress()">
			<div class="am-u-sm-4 am-pad-none">
				<img src="<%=resoursUrl%>resources/assets/image/grcenter_dz.png" width="12"/>&nbsp;&nbsp;地址管理
			</div>
			<div class="am-u-sm-7 am-pad-none" id="userAddr">
				<div class="add_tip">点击添加地址</div>
			</div>
			<div class="am-u-sm-1 am-pad-none am-text-right">
				<img src="<%=resoursUrl%>resources/assets/image/icon_plus_1.png" height="16"/>
			</div>
		</div>
	</div>


	<div class="am-u-sm-12 am-pad-none">
		<div class="am-u-sm-12 am-pad-none grxz_hyzl allorder">
			<div class="am-u-sm-12 hyzl_tex">
				<div class="am-u-sm-6 am-pad-none odtext">
					全部订单
				</div>
				<a onclick="toMyOrder()">
					<div class="am-u-sm-6 am-pad-none am-text-right odlink" style="color:#fff;">
						查看全部订单&nbsp;&nbsp;<img src="<%=resoursUrl%>resources/assets/image/icon-right.png" height="12" style="margin-top:-2px;" />
					</div>
				</a>
			</div>
		</div>
		<div class="am-u-sm-12 am-text-center am-pad-none odState" style="background-color:#fff;border:1px solid #b8bece;border-top:0;">
			<a onclick="toMyOrderForState(0)">
				<div class="am-u-sm-3 am-pad-none stateLie">
					<img src="<%=resoursUrl%>resources/assets/image/icon-dfk.png"/><br/>
					待付款<span class="stateNum" id="dfk"></span>
				</div>
			</a>
			<a onclick="toMyOrderForState(1)">
				<div class="am-u-sm-3 am-pad-none stateLie">
					<img src="<%=resoursUrl%>resources/assets/image/icon-dsh.png"/><br/>
					待收货<span class="stateNum" id="dsh"></span>
				</div>
			</a>
			<a onclick="toMyOrderForState(2)">
				<div class="am-u-sm-3 am-pad-none stateLie">
					<img src="<%=resoursUrl%>resources/assets/image/icon-ywc.png"/><br/>
					已完成<span class="stateNum" id="ywc"></span>
				</div>
			</a>
			<a onclick="toMyOrderForState(3)">
				<div class="am-u-sm-3 am-pad-none stateLie">
					<img src="<%=resoursUrl%>resources/assets/image/icon-tksh.png"/><br/>
					退款售后<span class="stateNum" id="tksh"></span>
				</div>
			</a>
		</div>
	</div>
	<div class="am-u-sm-12 am-pad-none grxz_hyzl">
		<div class="am-u-sm-12 hyzl_tex" onclick="toPayCode()">
			<div class="am-u-sm-8 am-pad-none">
				我的久零券
			</div>
			<div class="am-u-sm-4 am-pad-none am-text-right">
				<img src="<%=resoursUrl%>resources/assets/image/ewm.png" width="30"/>
			</div>
		</div>
		<div class="am-u-sm-12 grzx_midxx">
			<div class="am-u-sm-6 am-pad-none am-text-center midxx_li" style="border-left:1px solid #b8bece;" onclick="toDetail()">
				累计券额<br/>
				<span class="xx_col" id="ljje">0.0</span>
			</div>
			<div class="am-u-sm-6 am-pad-none am-text-center midxx_li" onclick="toPayCode()">
				久零券余额<br/>
				<span class="xx_col" id="dqye">0.0</span>
			</div>
		</div>
		<a onclick="toDetail()">

			<div class="am-u-sm-12 jf_list_two">
				<div class="am-u-sm-9 am-pad-none">
						<img src="<%=resoursUrl%>resources/assets/image/icon-jlqmx-1.png" width="12"/>&nbsp;&nbsp;久零券明细
				</div>
				<div class="am-u-sm-3 am-pad-none am-text-right">
					<img src="<%=resoursUrl%>resources/assets/image/icon_right.png"/>
				</div>
			</div>
		</a>
		<a onclick="toMyOrder()">
			<div class="am-u-sm-12 jf_list_two" onclick="toMyOrder()">
				<div class="am-u-sm-11 am-pad-none">
					<img src="<%=resoursUrl%>resources/assets/image/icon-tydfwf-1.png" width="12"/>&nbsp;&nbsp;我的订单
				</div>
				<div class="am-u-sm-1 am-pad-none am-text-right">
					<img src="<%=resoursUrl%>resources/assets/image/icon_right.png"/>
				</div>
			</div>
		</a>
		<a onclick="toPayCode()">
			<div class="am-u-sm-12 jf_list_two">
				<div class="am-u-sm-11 am-pad-none">
					<img src="<%=resoursUrl%>resources/assets/image/icon-jlqzfm-1.png" width="12"/>&nbsp;&nbsp;久零券支付码
				</div>
				<div class="am-u-sm-1 am-pad-none am-text-right">
					<img src="<%=resoursUrl%>resources/assets/image/icon_right.png"/>
				</div>
			</div>
		</a>
		<a onclick="toRecharegCard()">
			<div class="am-u-sm-12 jf_list_two">
				<div class="am-u-sm-11 am-pad-none">
					<img src="<%=resoursUrl%>resources/assets/image/icon-jlczk-1.png" width="12"/>&nbsp;&nbsp;久零券充值卡
				</div>
				<div class="am-u-sm-1 am-pad-none am-text-right">
					<img src="<%=resoursUrl%>resources/assets/image/icon_right.png"/>
				</div>
			</div>
		</a>
		<a onclick="toMycollection()">
			<div class="am-u-sm-12 jf_list_two">
				<div class="am-u-sm-11 am-pad-none">
					<img src="<%=resoursUrl%>resources/assets/image/icon-collection-1.png" width="12"/>&nbsp;&nbsp;我的收藏
				</div>
				<div class="am-u-sm-1 am-pad-none am-text-right">
					<img src="<%=resoursUrl%>resources/assets/image/icon_right.png"/>
				</div>
			</div>
		</a>
		<a onclick="toQuery()">
			<div class="am-u-sm-12 jf_list_two">
				<div class="am-u-sm-11 am-pad-none">
					<img src="<%=resoursUrl%>resources/assets/image/icon-qesasw-1.png" width="12"/>&nbsp;&nbsp;常见问题解答
				</div>
				<div class="am-u-sm-1 am-pad-none am-text-right">
					<img src="<%=resoursUrl%>resources/assets/image/icon_right.png"/>
				</div>
			</div>
		</a>
	</div>
</div>


<!--<div class="am-u-sm-12 grxz_top">
	<div class="am-u-sm-12 am-text-center am-pad-none">
		<img src="<%=resoursUrl%>resources/assets/image/logo.png" id="headWX2" style="width: 90px;height: 90px"/>

	</div>
</div>-->
<!--footer-->
<jsp:include page="/jsp/inc_bottom.jsp"></jsp:include>
<!--footer-->
<div class="am-modal am-modal-alert" tabindex="-1" id="my-alert">
	<div class="am-modal-dialog">
		<div class="am-modal-hd" id="alert_title">哎呦喂，出错啦</div>
		<div class="am-modal-bd" id="alert_message"></div>
		<div class="am-modal-footer">
			  <span class="am-modal-btn">确定</span>
		</div>
	</div>
</div>
<script>
    var ajaxpath="${pageContext.request.contextPath}";
    $(function() {

		if (window.name != "tempname") {
			location.reload();
			window.name = "tempname";
		}
		else {
			window.name = "";
		}
		loadUserInfo();
		loadJNInfo();
		loadMyOrderNumber();
		loadAddress();
		var site_url = window.document.location.href;
        var appid='${appid}';
        /* $.post("wx_js.do", {url: site_url,appid:appid}, function(data) {
            wx.config({
                debug : false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
                appId : data.jsData.appid, // 必填，公众号的唯一标识
                timestamp : data.jsData.timestamp, // 必填，生成签名的时间戳
                nonceStr : data.jsData.nonceStr, // 必填，生成签名的随机串
                signature : data.jsData.signature,// 必填，签名
                jsApiList : [ 'checkJsApi', 'scanQRCode', 'chooseImage',
                    'uploadImage' ]
                // 必填，需要使用的JS接口列表，所有JS接口列表见附录2
            });
            wx.ready(function() {
                // 1 判断当前版本是否支持指定 JS 接口，支持批量判断
                wx.checkJsApi({
                    jsApiList : [ 'scanQRCode', ],
                    success : function(res) {
                        if (res.checkResult.scanQRCode == false) {

                        }
                    }
                });
                wx.error(function(res) {
                    //alert("错误:"+res);
                });
            });
        }); */
    });

     function loadUserInfo()
	 { //查询用户信息
		 var url=ajaxpath+"/userCenter/getUserCenterInfo.do";
		 $.get(url,function(data){
			 if(data==null||data==""){
				 $("#alert_message").html("绑定信息有误，请联系客服！");
				 $("#my-alert").modal('open');
			 }else{
				 if(data.personName==""||data.personName==null){
					 $("#name").html(" ");
				 }else{
					 $("#name").html(data.personName);
				 }
				 if(data.phone==""||data.phone==null){
					 $("#userPhone").html(" ");
				 }else{
					 var phone=data.phone;
					 if(phone.length>10)
					 {
					 phone=phone.substring(0,3)+'****'+phone.substring(phone.length-4,phone.length);
					 }
					 else
					 {phone=phone.substring(0,1)+"*****";}
					 $("#userPhone").html(phone);
				 }
				 if(data.birthDay==""||data.birthDay==null){
				 }else{
					 $("#userBir").html(data.birthDay);
				 }

				 if(data.headimgurl==""||data.headimgurl==null){
					 $("#headWX").attr("src","<%=resoursUrl%>resources/assets/image/grcenter_tx.png");
				 }else{
					 $("#headWX").attr("src",data.headimgurl);
				 }
			 }
		 });
	 }
	 //查询用户90网信息
	 function loadJNInfo()
	 {
		 var url=ajaxpath+"/userCenter/getUserCenterJNInfo.do";
		 $.get(url,function(data){
			if(data.return_data!=undefined&&data.return_data!=null)
			{
				$("#xfcs").html(data.return_data.pay_cnt_90);
				$("#ljje").html((data.return_data.balance_90_total/100).toFixed(2));
				$("#dqye").html((data.return_data.balance_90/100).toFixed(2));
			}
		 });
	 }

    //加载久零币信息
    function loadJiulingCoinInfo(){
        var url=ajaxpath+"/coin/doQueryByOpenId.do";
        $.get(url,function(data){
            $("#coin_withdrawal").html(data.chargeAmount);
            $("#coin_total").html(data.totalAmount);
        });
    }

//查询用户订单数量
	 function loadMyOrderNumber()
	 {
		 var url=ajaxpath+"/order/getUserOrderNum.do";
		 $.get(url,function(data){
			var res=JSON.parse(data);
			 $("#dfk").html(res.dfk);
			 $("#dsh").html(res.dsh);
			 $("#ywc").html(res.ywc);
			 $("#tksh").html(res.tksh);
		 });
	 }
     //跳转个人资料页
     function toMyInfo(){
           window.location.href = ajaxpath+"/client_toClientInfo.do?guid="+ new Date(); 
     }
     //跳转我的账号页
     function toMyAccount(){
           window.location.href = ajaxpath+"/client_toAccountband.do?guid="+ new Date(); 
     }
     //跳转我的优惠券页
     function toMycoupons(){
           window.location.href = ajaxpath+"/client_toMycoupons.do?guid="+ new Date(); 
     }
     //跳转我的收藏页
     function toMycollection(){
           window.location.href = ajaxpath+"/client_toMycollection.do?guid="+ new Date(); 
     }
     //跳转收获地址
     function toAddress(){
           window.location.href = ajaxpath+"/client_toAddress.do?guid="+ new Date(); 
     }
     //跳转会员等级
     function toMemberRating(){
           window.location.href = ajaxpath+"/client_toMemberRating.do?guid="+ new Date(); 
     }
     //跳转我的积分
     function toMyIntegral(){
           window.location.href = ajaxpath+"/client_toMyIntegral.do?guid="+ new Date(); 
     }
	 //跳转我的生日
	 function toBirthDay(){
		 window.location.href = ajaxpath+"/client_toBirthDay.do?guid="+ new Date();
	 }
     //跳转我订单
     function toMyOrder(){
           window.location.href = ajaxpath+"/jsp/order/orderList.jsp?guid="+ new Date();
     }
     //跳转我订单
     function toMyOrderForState(state){
         window.location.href = ajaxpath+"/jsp/order/orderList.jsp?state="+state+"&guid="+ new Date();
     }
	 //跳转90明细
	 function toDetail(){
		 window.location.href = ajaxpath+"/jsp/client/detail_90_orange.jsp?guid="+ new Date();
	 }
	 //跳转90体验店记录
	 function toRecord(){
		 window.location.href = ajaxpath+"/jsp/client/record_90_orange.jsp?guid="+ new Date();
	 }
	 //跳转充值卡
	 function toRecharegCard(){
		 window.location.href = ajaxpath+"/jsp/client/rechargeCard_90_orange.jsp?guid="+ new Date();
	 }
	 //跳转支付码
	 function toPayCode(){
		 window.location.href = ajaxpath+"/jsp/client/payCode_90_orange.jsp?guid="+ new Date();
	 }

    //跳转久零币充值
    function toChargeCoin(){
        window.location.href = ajaxpath+"/jsp/client/toChargeCoin_90_orange.jsp?guid="+ new Date();
    }
    //跳转久零币明细
    function toCoinDetail(){
        window.location.href = ajaxpath+"/jsp/client/toCoinDetail_90_orange.jsp?guid="+ new Date();
    }

	 //跳转用户资料
	 function toUserInfo(){
		 window.location.href = ajaxpath+"/jsp/client/user_info.jsp?guid="+ new Date();
	 }

    //跳转常见问题
    function toQuery(){
        window.location.href = ajaxpath+"/jsp/client/user_question.jsp?guid="+ new Date();
    }

     //弹出二维码扫描
     function toGetCard(){
             wx.scanQRCode({
                 needResult: 0, // 默认为0，扫描结果由微信处理，1则直接返回扫描结果，
                 scanType: ["qrCode", "barCode"], // 可以指定扫二维码还是一维码，默认二者都有
                 success: function (res) {
                     var result = res.resultStr; // 当needResult 为 1 时，扫码返回的结果
                 }
             });
     }
     
     //我的二维码
     function toMyQRCode(){
            window.location.href = ajaxpath+"/client_MyQrCode.do?guid="+ new Date();
     }
	function loadAddress() {

		var url = ajaxpath + '/order/loadAddress.do';
		$.get(url,function(result) {
			var list = JSON.parse(result);
			if(list!=null&&list!=undefined&&list.length>0)
			{
				for(var i=0;i<list.length;i++)
				{
					var  data=list[i];
					if(data.isdefault==1)
					{

						var address=data.addDetail;
					if(address.length>11)
					{address=address.substring(0,10)+'……';}
						$("#userAddr").html(address);
					}
				}
			}
		});
	}

</script>
</body>
</html>
